using System;
using System.Linq;

namespace TimeMachine.Engine.Analytics
{
	public class PlotPoints
	{
		public PlotPoints(DateTime x, params double[] values)
			: this(x.ToFileTimeUtc(), x.ToShortDateString(), values)
		{
		}

		public PlotPoints(long x, params double[] values)
			: this(x, x.ToString(), values)
		{
		}

		public PlotPoints(long x, string xLabel, params double[] values)
		{
			X = x;
			XLabel = xLabel;
			Values = values;
		}


		public long X { get; set; }
		public string XLabel { get; set; }
		public double[] Values { get; private set; }

		public override string ToString()
		{
			return string.Format("X: {0}, Values: {1}", XLabel, Values.Any() ? Values[0] + "..." : "empty");
		}
	}
}